package com
{
  import mx.containers.HBox;
  import mx.containers.VBox;
  import mx.controls.Image;
  import mx.controls.Label;
  
  import flash.display.Sprite;
  import flash.text.TextField;
  import flash.events.Event;
  import flash.text.TextFieldAutoSize;
  import flash.text.StyleSheet;
  import flash.net.URLLoader;
  import flash.net.URLRequest;
    
  public class tileRenderer extends VBox
  {
  	private var lb:Label;
  	private var img:Image;
  	private var hbox:HBox;
  	private var inbox:VBox;
  	
    public function tileRenderer()
    {
      super();
      lb = new Label();
      img = new Image();  
      hbox = new HBox();
      inbox = new VBox();
		
    }
    
    override protected function createChildren():void
    {
    	super.createChildren();
    }
    
    override protected function commitProperties():void
    {
    	super.commitProperties();
    	try{
		  this.setStyle("verticalGap",4);
		  this.setStyle("horizontalAlign","center");
		  inbox.setStyle("verticalAlign","middle");		  
		  inbox.setStyle("horizontalAlign","center");		  
		  this.setStyle("paddingTop",10);
	      inbox.setStyle("backgroundColor","white");
	      inbox.setStyle("backgroundAlpha",0.1);
	      inbox.setStyle("cornerRadius",10);
	      inbox.setStyle("borderStyle","solid");
	      inbox.percentWidth = 90;
	      inbox.percentHeight = 90;
		  lb.text = data.label;
		  lb.percentWidth = 90;
		  lb.percentHeight = 10;
		  lb.setStyle("color","white");
		  lb.setStyle("fontsize",20);

		  if( data != null )
		  {
			  img.source = data.link;
			  inbox.addChild(img);
		  this.addChild(inbox);
		  this.addChild(lb);			  
		  }

    	}catch(e:Error){
    		trace(e);
    	}
      
    }    
  }
}